﻿<s:SurfaceUserControl x:Class="WikipediaSurfaceBrowser.ImagePad"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008" Background="Transparent" Loaded="SurfaceUserControl_Loaded">
    <Border Name="contentBorder" CornerRadius="5">
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF006699" Offset="0"/>
                <GradientStop Color="#AA006699" Offset="1"/>
            </LinearGradientBrush>
        </Border.Background>
        <Grid DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
            </Grid.RowDefinitions>
            <Viewbox Name="paintAreaViewBox" StretchDirection="Both" Stretch="Fill" 
                     Grid.Row="0" Grid.Column="0" 
                     Grid.ColumnSpan="3" Grid.RowSpan="3">
                <s:SurfaceInkCanvas UsesContactShape="True" Name="paintArea" Background="Transparent" IsHitTestVisible="False" />
            </Viewbox>
            <s:SurfaceToggleButton Width="70" VerticalAlignment="Center" Grid.Column="0" Grid.Row="1" Name="cmdPaintOnOff" Click="cmdPaintOnOff_Click">
                <Image Height="20" Width="20" Source="pack://application:,,,/Resources/Vista-desktop.png" />
            </s:SurfaceToggleButton>
            <s:SurfaceButton Width="70" VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" Name="cmdClear" Click="cmdClear_Click">
                <Image Height="20" Width="20" Source="pack://application:,,,/Resources/Vista-trashcan_empty-alt.png" />
            </s:SurfaceButton>
            <s:SurfaceButton Width="70" VerticalAlignment="Center" Grid.Column="2" Grid.Row="1" Name="cmdClose" Click="cmdClose_Click">
                <Image Height="20" Width="20" Source="pack://application:,,,/Resources/Vista-logout.png" />
            </s:SurfaceButton>
            <GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" BorderThickness="0" BorderBrush="Transparent" >
                <StackPanel 
                        Name="spColors" 
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                    <StackPanel.Resources>
                        <ControlTemplate x:Key="colorRadioButton" TargetType="{x:Type s:SurfaceRadioButton}">
                            <Border Name="border" Padding="1" BorderBrush="Black" BorderThickness="0" CornerRadius="2">
                                <ContentPresenter />
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter TargetName="border" Property="BorderThickness" Value="1" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>

                        <Style TargetType="Rectangle">
                            <Setter Property="Width" Value="20" />
                            <Setter Property="Height" Value="20" />
                        </Style>
                        <Style TargetType="s:SurfaceRadioButton">
                            <Setter Property="Template" Value="{StaticResource colorRadioButton}" />
                            <EventSetter Event="ToggleButton.Checked" Handler="Color_Checked" />
                        </Style>
                    </StackPanel.Resources>
                    <s:SurfaceRadioButton IsChecked="True">
                        <s:SurfaceRadioButton.Content>
                            <Rectangle Fill="Black" />
                        </s:SurfaceRadioButton.Content>
                    </s:SurfaceRadioButton>
                    <s:SurfaceRadioButton>
                        <s:SurfaceRadioButton.Content>
                            <Rectangle Fill="White" />
                        </s:SurfaceRadioButton.Content>
                    </s:SurfaceRadioButton>
                    <s:SurfaceRadioButton>
                        <s:SurfaceRadioButton.Content>
                            <Rectangle Fill="Yellow" />
                        </s:SurfaceRadioButton.Content>
                    </s:SurfaceRadioButton>
                    <s:SurfaceRadioButton>
                        <s:SurfaceRadioButton.Content>
                            <Rectangle Fill="Green" />
                        </s:SurfaceRadioButton.Content>
                    </s:SurfaceRadioButton>
                    <s:SurfaceRadioButton>
                        <s:SurfaceRadioButton.Content>
                            <Rectangle Fill="Blue" />
                        </s:SurfaceRadioButton.Content>
                    </s:SurfaceRadioButton>
                    <s:SurfaceRadioButton>
                        <s:SurfaceRadioButton.Content>
                            <Rectangle Fill="Red" />
                        </s:SurfaceRadioButton.Content>
                    </s:SurfaceRadioButton>
                </StackPanel>
            </GroupBox>
        </Grid>
    </Border>
</s:SurfaceUserControl>
